package com.cssy.yd.basic.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;

import com.byd.acegiext.domain.User;
import com.cssy.yd.basic.dao.BasicBomSubstituteDAO;
import com.cssy.yd.basic.entity.BasicBomInfoDO;
import com.cssy.yd.basic.entity.BasicBomSubstituteDO;
import com.cssy.yd.basic.service.IBasicBomSubstituteService;
import com.plat.exception.SyBaseException;
import com.plat.helper.SearchConditions;
import com.plat.helper.SearchResult;
import com.plat.util.IDCodeTypeUtil;

@Service("basicBomSubstituteService")
public class BasicBomSubstituteServiceImpl implements
		IBasicBomSubstituteService {
	
	@Resource(name="basicBomSubstituteDAO")
	private BasicBomSubstituteDAO basicBomSubstituteDAO;
	
	
	@Override
	public SearchResult findListByExample(SearchConditions scs)
			throws SyBaseException {
		SearchResult rs=new SearchResult(scs);
		List<BasicBomSubstituteDO>  list=basicBomSubstituteDAO.find(scs);
		rs.setRecordCount(basicBomSubstituteDAO.count(scs));
		rs.setResults(list);
		return rs;
	}

	@Override
	public Integer delete(String id, User user) throws SyBaseException {
		basicBomSubstituteDAO.deleteBasicBomSubstituteDOByPrimaryKey(id);
		return null;
	}

	@Override
	public Integer update(BasicBomSubstituteDO t, User user)
			throws SyBaseException {
		t.setDuuser(user.getName());
		t.setDutime(new Date());
		return basicBomSubstituteDAO.updateBasicBomSubstituteDO(t);
	}

	@Override
	public BasicBomSubstituteDO save(BasicBomSubstituteDO t, User user)
			throws SyBaseException {
		t.setDcruser(user.getName());
		t.setDctime(new Date());
		t.setComponentSequenceId(IDCodeTypeUtil.getId());
		basicBomSubstituteDAO.insertBasicBomSubstituteDO(t);
		return t;
	}

	@Override
	public BasicBomSubstituteDO findListById(String id) throws SyBaseException {
		return basicBomSubstituteDAO.findBasicBomSubstituteDOByPrimaryKey(id);
	}

	@Override
	public List<BasicBomSubstituteDO> findListByExample(
			BasicBomSubstituteDO bomSubstituteDO) throws SyBaseException {
		return basicBomSubstituteDAO.findListByExample(bomSubstituteDO);
	}

	@Override
	public Integer deleteBizRemoved(String id) throws SyBaseException {
		// TODO Auto-generated method stub
		return null;
	}

}
